/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Renaming.java
 *
 * Created on 19 Μαϊ 2011, 7:10:48 μμ
 */
package tools.options.panels;

import com.googlecode.svalidators.validators.FilepathValidator;
import com.googlecode.svalidators.validators.RegularExpressionValidator;
import myseriesproject.MySeries;
import tools.options.IMySeriesOptions;

/**
 *
 * @author lordovol
 */
public class Renaming extends javax.swing.JPanel  implements IMySeriesOptions {

  private String sepRegex = "^[^/\\\\?%*:|\\\"<>\\.]*$";

  /** Creates new form Renaming */
  public Renaming() {
    initComponents();
    tf_episodeSep.addValidator(new RegularExpressionValidator("x", sepRegex, false, true));
    tf_seasonSep.addValidator(new RegularExpressionValidator("s", sepRegex, false, true));
    tf_titleSep.addValidator(new RegularExpressionValidator(" ", sepRegex, false, true));
    tf_episodeSep.setTrimValue(false);
    tf_seasonSep.setTrimValue(false);
    tf_titleSep.setTrimValue(false);
  }

  /** This method is called from within the constructor to
   * initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is
   * always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        tf_seasonSep = new com.googlecode.svalidators.formcomponents.STextField();
        tf_episodeSep = new com.googlecode.svalidators.formcomponents.STextField();
        tf_titleSep = new com.googlecode.svalidators.formcomponents.STextField();
        cb_noRenameConf = new javax.swing.JCheckBox();
        cd_autoRename = new javax.swing.JCheckBox();
        jLabel6 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();

        setName("Renaming"); // NOI18N
        setPreferredSize(new java.awt.Dimension(400, 210));

        jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel18.setText("Season separator :");

        jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel19.setText("Episode separator :");

        jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel20.setText("Title separator :");

        tf_seasonSep.setText(MySeries.options.getStringOption(SEASON_SEPARATOR,false));
        tf_seasonSep.setName(SEASON_SEPARATOR);

        tf_episodeSep.setText(MySeries.options.getStringOption(EPISODE_SEPARATOR,false));
        tf_episodeSep.setName(EPISODE_SEPARATOR);

        tf_titleSep.setText(MySeries.options.getStringOption(TITLE_SEPARATOR,false));
        tf_titleSep.setName(TITLE_SEPARATOR);

        cb_noRenameConf.setSelected(MySeries.options.getBooleanOption(NO_RENAME_CONFIRMATION));
        cb_noRenameConf.setText("Fast single episode renaming");
        cb_noRenameConf.setToolTipText("<html>\nWhen this is checked renaming of a single episode will not bring up the renaming window<br />\nand the files will be renamed with the current renaming options");
        cb_noRenameConf.setMargin(new java.awt.Insets(0, 0, 0, 0));
        cb_noRenameConf.setName(NO_RENAME_CONFIRMATION);
        cb_noRenameConf.setOpaque(false);

        cd_autoRename.setSelected(MySeries.options.getBooleanOption(AUTO_RENAME_SUBS));
        cd_autoRename.setText("Auto Renaming");
        cd_autoRename.setToolTipText("<html>Rename subtitles when unzipped or moved from the main series directory to the series directory where they belong");
        cd_autoRename.setMargin(new java.awt.Insets(0, 0, 0, 0));
        cd_autoRename.setName(AUTO_RENAME_SUBS);
        cd_autoRename.setOpaque(false);
        cd_autoRename.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cd_autoRenameActionPerformed(evt);
            }
        });

        jLabel6.setFont(jLabel6.getFont().deriveFont((jLabel6.getFont().getStyle() | java.awt.Font.ITALIC), jLabel6.getFont().getSize()-1));
        jLabel6.setText("(Rename single episodes without naming confirmation)");

        jLabel12.setFont(jLabel12.getFont().deriveFont((jLabel12.getFont().getStyle() | java.awt.Font.ITALIC), jLabel12.getFont().getSize()-1));
        jLabel12.setText("(Auto rename subtitles when downloaded,");

        jLabel13.setFont(jLabel13.getFont().deriveFont((jLabel13.getFont().getStyle() | java.awt.Font.ITALIC), jLabel13.getFont().getSize()-1));
        jLabel13.setText("unziped or moved from the Main Series Directory)");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel18, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tf_seasonSep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(330, 330, 330))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(cb_noRenameConf, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel20, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel19, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(tf_episodeSep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(tf_titleSep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(331, 331, 331))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(cd_autoRename, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 269, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)))
                        .addGap(240, 240, 240))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tf_seasonSep, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tf_episodeSep, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tf_titleSep, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cb_noRenameConf)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel6)
                .addGap(9, 9, 9)
                .addComponent(cd_autoRename, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel12)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel13)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void cd_autoRenameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cd_autoRenameActionPerformed
      // TODO add your handling code here:
}//GEN-LAST:event_cd_autoRenameActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JCheckBox cb_noRenameConf;
    public javax.swing.JCheckBox cd_autoRename;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel6;
    public com.googlecode.svalidators.formcomponents.STextField tf_episodeSep;
    public com.googlecode.svalidators.formcomponents.STextField tf_seasonSep;
    public com.googlecode.svalidators.formcomponents.STextField tf_titleSep;
    // End of variables declaration//GEN-END:variables
}
